home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / programm / gemfsc20 / gemfsc20.lzh / GNUGEM27 / AESHELL.C < prev    next >
C/C++ Source or Header  |  1993-03-24  |  3KB  |  119 lines

  1. /*
  2.  *    Aes shel library interface
  3.  *
  4.  *        shel_read    identify involing command
  5.  *        shel_write    tell aes to run another app.
  6.  *        shel_find    find a file in path
  7.  *        shel_envrn    search environment for param
  8.  *        shel_get    read from aes shel buffer
  9.  *        shel_put    write to aes shel buffer
  10.  *
  11.  *        ++jrb    bammi@cadence.com
  12.  *        modified: mj -- ntomczak@vm.ucs.ualberta.ca
  13.  */
  14. #include "common.h"
  15.  
  16. #ifdef __DEF_ALL__
  17.  
  18. #define L_shel_rea
  19. #define L_shel_wri
  20. #define L_shel_fin
  21. #define L_shel_env
  22. #define L_shel_get
  23. #define L_shel_put
  24.  
  25. #endif /* __DEF_ALL__ */
  26.  
  27.  
  28. #ifdef L_shel_rea
  29.  
  30. /* identify invoking command
  31.  *    returns 0 on erorr    >0 no error
  32.  */
  33. int shel_read(char *Command, char *Tail)
  34. {
  35.     _addrin[0] = Command;
  36.     _addrin[1] = Tail;
  37.     return __aes__(AES_CONTROL_ENCODE(120, 0, 1, 2));
  38. }
  39. #endif /* L_shel_rea */
  40.  
  41. #ifdef L_shel_wri
  42.  
  43. /* tell aes whether to run another app, and if so which one
  44.  *    returns = 0 on error    >0 no error
  45.  */
  46. int shel_write(int Exit, int Graphic, int Aes, char *Command, char *Tail)
  47. {
  48.     _int_in[0] = Exit;        /* exit to DESKTOP = 0, = 1 run another */
  49.     _int_in[1] = Graphic;    /* graphical ap = 1, = 0 tos ap         */
  50.     _int_in[2] = Aes;        /* aes appl - currently ignored         */
  51.  
  52.     _addrin[0] = Command;    /* filename */
  53.     _addrin[1] = Tail;        /* command tail : count|args */
  54.  
  55.     return __aes__(AES_CONTROL_ENCODE(121, 3, 1, 2));
  56. }
  57. #endif /* L_shel_wri */
  58.  
  59. #ifdef L_shel_fin
  60.  
  61. /* search for filename
  62.  *    returns 0 on error    >0 no error
  63.  */
  64. int shel_find(char *buf)    /* i/o param */
  65. {
  66.     _addrin[0] = buf;
  67.     return __aes__(AES_CONTROL_ENCODE(124, 0, 1, 1));
  68. }
  69. #endif /* L_shel_fin */
  70.  
  71. #ifdef L_shel_env
  72.  
  73. /* search env
  74.  *    returns reserved value
  75.  */
  76. int shel_envrn(char *result, char *param)
  77. {
  78.     _addrin[0] = result;    /* addr of byte following param stored here */
  79.     _addrin[1] = param;
  80.  
  81.     return __aes__(AES_CONTROL_ENCODE(125, 0, 1, 2));
  82. }
  83. #endif /* L_shel_env */
  84.  
  85. #ifdef L_shel_get
  86.  
  87. /* read upto 1024 bytes from aes internal shel buffer
  88.  * currently the desktop stores desktop.inf in this buffer
  89.  *
  90.  *    returns 0 on error, > 0 no error
  91.  */
  92. int shel_get(char *Buf, int Len)
  93. {
  94.     _addrin[0] = Buf;
  95.     _int_in[0] = Len;
  96.  
  97.     return __aes__(AES_CONTROL_ENCODE(122, 1, 1, 1));
  98. }
  99. #endif /* L_shel_get */
  100.  
  101. #ifdef L_shel_put
  102.  
  103. /* write upto 1024 bytes from to internal shel buffer
  104.  * currently the desktop stores desktop.inf here, writing to
  105.  * it will flush that out
  106.  *
  107.  *    returns 0 on error, > 0 no error
  108.  */
  109. int shel_put(char *Buf, int Len)
  110. {
  111.     _addrin[0] = Buf;
  112.     _int_in[0] = Len;
  113.  
  114.     return __aes__(AES_CONTROL_ENCODE(123, 1, 1, 1));
  115. }
  116. #endif /* L_shel_put */
  117.  
  118. /* -eof- */
  119.